package com.hangzhou.xyj.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hangzhou.xyj.ui.fragment.TopListFragment;

import java.util.List;

/**
 * Created by DT-038 on 2015/12/22.
 * 唱戏页面ViewPager的Adapter
 */
public class HomeSingVPAdapter extends FragmentPagerAdapter {
    private final String[] mTitles = {
            "专业",
            "戏友",
    };

    private List<TopListFragment> mListFragment;

    /**
     * 构造方法
     *
     * @param fragmentList 集合中包含2个Fragment：第一个Fragment为专业；第二个Fragment为戏友
     * @return
     * @author yaohuix
     * @date 2016/3/11 9:52
     */
    public HomeSingVPAdapter(FragmentManager fm, List<TopListFragment> fragmentList) {
        super(fm);
        mListFragment = fragmentList;
    }

    @Override
    public Fragment getItem(int position) {
        return mListFragment.get(position);
    }

    @Override
    public int getCount() {
        return mListFragment.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
